import { fliterPermission } from '@/utils/sys.js'
export const apis = {
  list: `/business/basis/getList?modelCode=MODEL_NOTICE&authCode=FUNCTION_NOTICE_LIST`,
  detail: `business/basis/detail?modelCode=MODEL_NOTICE&authCode=BTN_NOTICE_DETAIL`,
  state: `business/notice/state?authCode=BTN_NOTICE_STATE`,
  add: `business/notice/add?authCode=BTN_NOTICE_ADD`,
  edit: `business/notice/edit?authCode=BTN_NOTICE_EDIT`,
  top: `business/notice/top?authCode=BTN_NOTICE_TOP`,
  del:`business/notice/del?authCode=BTN_NOTICE_DEL`,
};

export const configs = {
  listUrl: apis.list,
  pageOn: true, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
};


export const searchs = [
  {
    type: "Input",
    column: "notice_title",
    label: "标题",
  },
  {
    type: "Select",
    column: "notice_state",
    label: "状态",
    dimCode: "DIM_TYPE_STATE"
  }
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "utime",
      sort: "desc",
    },
  ],
};
export const columns = [
  { type: "selection" },
  // {
  //   label: "ID",
  //   column: "id",
  //   sortable: "custom"
  // },
  
  {
    label: "公告标题",
    column: "notice_title",
  },
  {
    label: "公告状态",
    column: "notice_state",
    display: "state",
    format:'dim'
  },
  {
    label: "自动弹出",
    column: "notice_show",
    display: "state",
    format:'dim'
  },
  {
    label: "创建时间",
    column: "ctime",
    format: "datetime",
    display: "text",
  },
  { label: "操作", column: "operate", width: "200", fixed: "right" },
];

export const buttons = fliterPermission([
  {
    operate: "add",
    text: "新增",
    permission: "BTN_NOTICE_ADD",
  },
  {
    operate: "stateOn",
    text: "启用",
    permission: 'BTN_NOTICE_STATE',
  },
  {
    operate: "stateOff",
    text: "禁用",
    permission: 'BTN_NOTICE_STATE',
  },
 
])
export const columnButtons = fliterPermission([
  {
    operate: "edit",
    text: "编辑",
    permission: 'BTN_NOTICE_EDIT',
  },
  {
    operate: "detail",
    text: "详情",
    permission: 'BTN_NOTICE_DETAIL',
  },
  {
    operate: "top",
    text: "置顶",
    permission: 'BTN_NOTICE_TOP',
  },
  {
    operate: "delete",
    text: "删除",
    permission: "BTN_NOTICE_DEL",
    type: 'danger'
  },
]);
